local hash_key_ht = KEYS[1];
local bucket_key_zset = KEYS[2];
local hash_key = KEYS[3];
local bucket_key = ARGV[1];

local result = {};

if redis.call('ZREM',bucket_key_zset,bucket_key) > 0 then
    local message = redis.call('HGET',hash_key_ht,hash_key);
    table.insert(result, message);
    redis.call('HDEL',hash_key_ht,hash_key);
end

return result;



